from datetime import *
import os
import time as T

tmNow = datetime.now()
d = date.today()


L=[]
with open('../off.txt','r')as F:
     for i in F:
          L.append(int(i))
     print(L[0],L[1],L[2])
     t = time(L[0],L[1],L[2])


shtdownTime = datetime.combine(d,t)

def ShutDown():
     tmNow = datetime.now()
     timedDelta = (shtdownTime - tmNow).total_seconds()
     if timedDelta < -5:
          print('过时')
          return ('continue')
     if timedDelta < 181 and timedDelta > -4:
          os.system('shutdown -s -f -t 180')
          print('到时')
          return ('break')
     else:
          print('没到')
          return ('continue')
          
            
if __name__ == '__main__':
     T.sleep(2)
     while True:
          if ShutDown()=='break':
               T.sleep(2)
               break
          else:
               T.sleep(2)
               continue






